package com.zs.service;

import com.zs.dao.UserDao;
import com.zs.model.MyResult;
import com.zs.model.User;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service(value = "userService")
public class UserServiceImpl implements UserService {

    @Setter
    @Getter
    @Autowired
    private UserDao userDao;

    @Override
    public MyResult login(User user) {
        User u = userDao.login(user);
        MyResult result = new MyResult();
        if (u != null) {
            result.setCode(0);
            result.setMsg("登陆成功");
            result.setObj(u);
        } else {
            result.setCode(1);
            result.setMsg("登录失败");
        }
        return result;
    }
}
